package com.ltg.urban.domain.project.controller;

import com.ltg.framework.annotation.DescribePage4Swagger;
import com.ltg.framework.util.http.PageInfo;
import com.ltg.framework.util.http.PageRequest;
import com.ltg.framework.util.http.Result;
import com.ltg.urban.domain.project.data.response.CapitalDetailResp;
import com.ltg.urban.domain.project.data.response.UrbanCapitalPageResp;
import com.ltg.urban.domain.project.service.UrbanProjectUserService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.servlet.http.HttpServletRequest;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

/**
 * <p> ClassName: UrbanCapitalController </p>
 * <p> Package: com.ltg.urban.domain.project.controller </p>
 * <p> Description: </p>
 * <p></p>
 *
 * @Author: LTG
 * @Create: 2023/2/24 - 9:28
 * @Version: v1.0
 */

@RestController
@Tag(name = "资金模块")
@RequiredArgsConstructor
@RequestMapping("/api/v1/capital")
public class UrbanCapitalController {

    private final UrbanProjectUserService urbanProjectUserService;

    @Operation(summary = "资金分页查询:OK")
    @GetMapping("/query")
    @DescribePage4Swagger
    public PageInfo<UrbanCapitalPageResp> query(HttpServletRequest httpServletRequest,
                                                @RequestParam(required = false) String keyword,
                                                @RequestParam(required = false) Integer approveResult) {
        return urbanProjectUserService.pageList(PageRequest.buildFromRequest(httpServletRequest), keyword, approveResult);
    }

    @Operation(summary = "资金详情:OK")
    @GetMapping("/{capitalId}/detail")
    @DescribePage4Swagger
    public Result<CapitalDetailResp> employeeApplyCapital(HttpServletRequest httpServletRequest, @PathVariable Long capitalId) {
        return urbanProjectUserService.detail(PageRequest.buildFromRequest(httpServletRequest), capitalId);
    }


}
